package com.tanhua.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanhua.domain.Log;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface LogMapper extends BaseMapper<Log> {

    @Select("select COUNT(distinct user_id) from tb_log where log_time=#{logTime} and type=#{type}")
    Integer findNumLogin(@Param("logTime") String time, @Param("type") String s);

    @Select("select COUNT(distinct user_id) from tb_log where log_time=#{logTime}")
    Integer findNumActive(@Param("logTime") String time);

    @Select("select COUNT(distinct user_id) from tb_log where log_time=#{yesterday} and user_id in( select distinct user_id from tb_log where log_time=#{time} )")
    Integer findNumRetention1d(@Param("yesterday") String yesterday, @Param("time") String time);
}